package com.jysz.certificate.persistence.model.cm;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


import com.jysz.certificate.persistence.enums.CertificateStatus;
import com.jysz.certificate.persistence.model.system.Brand;
import com.jysz.certificate.persistence.model.system.Financial;
import com.jysz.certificate.persistence.model.system.Shop;
import com.jysz.certificate.persistence.model.system.User;
import com.jysz.webcore.ssh.entity.AbstractBaseEntity;

@Entity
@Table(name = "cm_certificate_")
@org.hibernate.annotations.Entity
public class Certificate extends AbstractBaseEntity<Long> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private User user;// 创建人
	private Shop shop;// 销售店
	private Financial financial;// 金融机构
	private Brand brand;// 主机厂<品牌>
	private Certification certification;//合格证主表
	private CertificateStatus status;//修改状态 
	private String certificationNum;// 合格证号
	private Date departDate;// 发车日期
	private String motorcycleType;// 车型
	private String chassis;// 车架号
	private String engine;// 发动机号
	private String orderNumber;// 订单号
	private double supplyPrice;// 供货价begin
	private String draft;// 汇票号
	private Date draftBeginDate;// 汇票号开始时间
	private Date draftEndDate;// 汇票号结束时间
	private Date goingOutDate;// 出门日
	private Date scheduledDate;// 预计到店日
	private Date createDate;// 创建日期
	private Date receiveDate;// 确认收证时间
	private Date leaveDate;// 释放时间
	private String remark;//审核意见
	private String reson;//申请理由

	@Column(name = "_reson", columnDefinition="varchar(255)")
	public String getReson() {
		return reson;
	}

	public void setReson(String reson) {
		this.reson = reson;
	}

	@Column(name = "_remark", columnDefinition="varchar(255)")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "_certification_id",columnDefinition="bigint(20)")
	public Certification getCertification() {
		return certification;
	}

	public void setCertification(Certification certification) {
		this.certification = certification;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "_user_id",columnDefinition="bigint(20)")
	public User getUser() {
		return user;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "_financial_id",columnDefinition="bigint(20)")
	public Financial getFinancial() {
		return financial;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "_shop_id",columnDefinition="bigint(20)")
	public Shop getShop() {
		return shop;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "_brand_id",columnDefinition="bigint(20)")
	public Brand getBrand() {
		return brand;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}

	public void setFinancial(Financial financial) {
		this.financial = financial;
	}

	public void setBrand(Brand brand) {
		this.brand = brand;
	}

	@Column(name = "_certificationNum", unique = true,columnDefinition="varchar(255)")
	public String getCertificationNum() {
		return certificationNum;
	}

	public void setCertificationNum(String certificationNum) {
		this.certificationNum = certificationNum;
	}

	@Column(name = "_departDate")
	public Date getDepartDate() {
		return departDate;
	}

	public void setDepartDate(Date departDate) {
		this.departDate = departDate;
	}

	@Column(name = "_motorcycleType",columnDefinition="varchar(255)")
	public String getMotorcycleType() {
		return motorcycleType;
	}

	public void setMotorcycleType(String motorcycleType) {
		this.motorcycleType = motorcycleType;
	}

	@Column(name = "_chassis", nullable = false, unique = true,columnDefinition="varchar(255)")
	public String getChassis() {
		return chassis;
	}

	public void setChassis(String chassis) {
		this.chassis = chassis;
	}

	@Column(name = "_engine",columnDefinition="varchar(255)")
	public String getEngine() {
		return engine;
	}

	public void setEngine(String engine) {
		this.engine = engine;
	}

	@Column(name = "_orderNumber",columnDefinition="varchar(255)")
	public String getOrderNumber() {
		return orderNumber;
	}

	public void setOrderNumber(String orderNumber) {
		this.orderNumber = orderNumber;
	}

	@Column(name = "_supplyPrice",columnDefinition="numeric(9,2)")
	public double getSupplyPrice() {
		return supplyPrice;
	}

	public void setSupplyPrice(double supplyPrice) {
		this.supplyPrice = supplyPrice;
	}

	@Column(name = "_draft",columnDefinition="varchar(255)")
	public String getDraft() {
		return draft;
	}

	public void setDraft(String draft) {
		this.draft = draft;
	}

	@Column(name = "_draftBeginDate")
	public Date getDraftBeginDate() {
		return draftBeginDate;
	}

	public void setDraftBeginDate(Date draftBeginDate) {
		this.draftBeginDate = draftBeginDate;
	}

	@Column(name = "_draftEndDate")
	public Date getDraftEndDate() {
		return draftEndDate;
	}

	public void setDraftEndDate(Date draftEndDate) {
		this.draftEndDate = draftEndDate;
	}

	@Column(name = "_goingOutDate")
	public Date getGoingOutDate() {
		return goingOutDate;
	}

	public void setGoingOutDate(Date goingOutDate) {
		this.goingOutDate = goingOutDate;
	}

	@Column(name = "_scheduledDate")
	public Date getScheduledDate() {
		return scheduledDate;
	}

	public void setScheduledDate(Date scheduledDate) {
		this.scheduledDate = scheduledDate;
	}

	@Column(name = "_createDate")
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Column(name = "_receiveDate")
	public Date getReceiveDate() {
		return receiveDate;
	}

	public void setReceiveDate(Date receiveDate) {
		this.receiveDate = receiveDate;
	}

	@Column(name = "_leaveDate")
	public Date getLeaveDate() {
		return leaveDate;
	}

	public void setLeaveDate(Date leaveDate) {
		this.leaveDate = leaveDate;
	}


	@Column(name = "_status",columnDefinition="int(2)")
	@Enumerated(EnumType.ORDINAL)
	public CertificateStatus getStatus() {
		return status;
	}

	public void setStatus(CertificateStatus status) {
		this.status = status;
	}

	/** begin properties column constan **/
	public static final String SHOP = "shop";
	public static final String BRAND = "brand";
	public static final String DEPARTDATE = "departDate";
	/** end properties column constan **/
}
